﻿using IS_Ever_Green.DataAccess.Model.Repositories;
using IS_Ever_Green.DataAccess.Model;
using System.Collections.ObjectModel;
using System.Windows.Input;

namespace IS_Ever_Green.ViewModel
{
    public class ReadyComputerViewModel : BaseViewModel
    {
        private IProductRepository _productRepository;
        private ObservableCollection<ProductModel> _readyComputerList;
        private string _textReadyComputer;

        public ObservableCollection<ProductModel> ReadyComputerList
        {
            get { return _readyComputerList; }
            set { _readyComputerList = value; OnPropertyChanged(nameof(ReadyComputerList)); }
        }

        public string TextReadyComputer
        {
            get { return _textReadyComputer; }
            set { _textReadyComputer = value; OnPropertyChanged(nameof(TextReadyComputer)); }
        }

        public ICommand AddProductCart { get; }
        public ICommand AddProductLike { get; }
        public ICommand DeleteProductCart { get; }
        public ICommand DeleteProductLike { get; }

        public ReadyComputerViewModel()
        {
            _productRepository = new ProductRepository();

            ShowProductFromReadyComputer();
        }

        public void ShowProductFromReadyComputer()
        {
            ReadyComputerList = new ObservableCollection<ProductModel>(_productRepository.GetProductWithCategory(1));
            if (ReadyComputerList.Count != 0)
            {
                TextReadyComputer = "Готовые ПК";
            }
        }
    }
}
